import http from './index'

export function apiUserLogin <T> (data: any): Promise<T> {
  return http({
    method: 'post',
    url: '/api/v1/login',
    data
  })
}

export function apiGetArticleList <T> (params: any): Promise<T> {
  return http({
    method: 'get',
    url: '/api/v1/article',
    params
  })
}

export function apiDeleteArticle <T> (id: number): Promise<T> {
  return http({
    method: 'delete',
    url: `/api/v1/article?id=${id}`
  })
}

export function apiApproveArticle <T> (data: any): Promise<T> {
  return http({
    method: 'post',
    url: '/api/v1/article/approve',
    data
  })
}

export function apiReapproveArticle <T> (data: any): Promise<T> {
  return http({
    method: 'post',
    url: '/api/v1/article/reapprove',
    data
  })
}

export function apiGetCircleList <T> (params: any): Promise<T> {
  return http({
    method: 'get',
    url: '/api/v1/circle',
    params
  })
}

export function apiDeleteCircle <T> (id: number): Promise<T> {
  return http({
    method: 'delete',
    url: `/api/v1/circle?id=${id}`
  })
}

export function apiGetFeedbackList <T> (params: any): Promise<T> {
  return http({
    method: 'get',
    url: '/api/v1/feedback',
    params
  })
}

export function apiDeleteFeedback <T> (id: any): Promise<T> {
  return http({
    method: 'delete',
    url: `/api/v1/feedback?id=${id}`
  })
}

export function apiGetUserList <T> (params: any): Promise<T> {
  return http({
    method: 'get',
    url: '/api/v1/user',
    params
  })
}

export function apiUpdateUser <T> (data: any): Promise<T> {
  return http({
    method: 'put',
    url: '/api/v1/user',
    data
  })
}

export function apiUpdateUserStatus <T> (params: any): Promise<T> {
  return http({
    method: 'put',
    url: '/api/v1/user/updateStatus',
    params
  })
}

export function apiGetDynamicList <T> (params: any): Promise<T> {
  return http({
    method: 'get',
    url: '/api/v1/dynamic',
    params
  })
}

export function apiBatchDeleteDynamic <T> (data: any): Promise<T> {
  return http({
    method: 'delete',
    url: '/api/v1/dynamic',
    data
  })
}

export function apiGetArticleCommentList <T> (params: any): Promise<T> {
  return http({
    method: 'get',
    url: '/api/v1/comment/article',
    params
  })
}

export function apiDeleteArticleComment <T> (params: any): Promise<T> {
  return http({
    method: 'delete',
    url: '/api/v1/comment/article',
    params
  })
}

export function apiGetCircleCommentList <T> (params: any): Promise<T> {
  return http({
    method: 'get',
    url: '/api/v1/comment/circle',
    params
  })
}

export function apiDeleteCircleComment <T> (params: any): Promise<T> {
  return http({
    method: 'delete',
    url: '/api/v1/comment/circle',
    params
  })
}

export function apiGetStaffList <T> (params: any): Promise<T> {
  return http({
    method: 'get',
    url: '/api/v1/staff',
    params
  })
}

export function apiGetRoleList <T> (): Promise<T> {
  return http({
    method: 'get',
    url: '/api/v1/role'
  })
}

export function apiCreateRole <T> (data: any): Promise<T> {
  return http({
    method: 'post',
    url: '/api/v1/role',
    data
  })
}

export function apiUpdateRole <T> (data: any): Promise<T> {
  return http({
    method: 'put',
    url: '/api/v1/role',
    data
  })
}

export function apiRoleAssignPermission <T> (data: any): Promise<T> {
  return http({
    method: 'post',
    url: '/api/v1/role/assign',
    data
  })
}

export function apiDeleteRole <T> (id: number): Promise<T> {
  return http({
    method: 'delete',
    url: `/api/v1/role?id=${id}`
  })
}

export function apiCreateStaff <T> (data: any): Promise<T> {
  return http({
    method: 'post',
    url: '/api/v1/staff',
    data
  })
}

export function apiUpdateStaff <T> (data: any): Promise<T> {
  return http({
    method: 'put',
    url: '/api/v1/staff',
    data
  })
}

export function apiBatchDeleteStaff <T> (data: any): Promise<T> {
  return http({
    method: 'delete',
    url: '/api/v1/staff',
    data
  })
}

export function apiUpdateStaffStatus <T> (data: any): Promise<T> {
  return http({
    method: 'put',
    url: '/api/v1/staff/updateStatus',
    data
  })
}

export function apiGetResourceTreeList <T> (params: any): Promise<T> {
  return http({
    method: 'get',
    url: '/api/v1/resource',
    params
  })
}

export function apiDeleteResource <T> (id: number): Promise<T> {
  return http({
    method: 'delete',
    url: `/api/v1/resource?id=${id}`
  })
}

export function apiCreateResource <T> (data: any): Promise<T> {
  return http({
    method: 'post',
    url: '/api/v1/resource',
    data
  })
}

export function apiUpdateResource <T> (data: any): Promise<T> {
  return http({
    method: 'put',
    url: '/api/v1/resource',
    data
  })
}

export function apiGetRolePermissions <T> (roleId: number): Promise<T> {
  return http({
    method: 'get',
    url: `/api/v1/role/permissions?roleId=${roleId}`
  })
}

export function apiGetLoginLogs <T> (params: any): Promise<T> {
  return http({
    method: 'get',
    url: '/api/v1/loginlog',
    params
  })
}

export function apiGetConfig <T> (): Promise<T> {
  return http({
    method: 'get',
    url: '/api/v1/query/config'
  })
}

export function apiSetConfig <T> (data: any): Promise<T> {
  return http({
    method: 'put',
    url: '/api/v1/set/config',
    data
  })
}

export function apiGetToolList <T> (name: string): Promise<T> {
  return http({
    method: 'get',
    url: `/api/v1/tool?name=${name}`
  })
}

export function apiDeleteTools <T> (data: any): Promise<T> {
  return http({
    method: 'delete',
    url: '/api/v1/tool',
    data
  })
}

export function apiCreateTool <T> (data: any): Promise<T> {
  return http({
    method: 'post',
    url: '/api/v1/tool',
    data
  })
}

export function apiUpdateTool <T> (data: any): Promise<T> {
  return http({
    method: 'put',
    url: '/api/v1/tool',
    data
  })
}

export function apiGetToolClassifyList <T> (): Promise<T> {
  return http({
    method: 'get',
    url: '/api/v1/tool/classify'
  })
}

export function apiBatchImportTool <T> (data: any): Promise<T> {
  return http({
    method: 'post',
    url: '/api/v1/tool/batch-import',
    data
  })
}

export function apiDeleteToolClassifys <T> (data: any): Promise<T> {
  return http({
    method: 'delete',
    url: '/api/v1/tool/classify',
    data
  })
}

export function apiCreateToolClassify <T> (data: any): Promise<T> {
  return http({
    method: 'post',
    url: '/api/v1/tool/classify',
    data
  })
}

export function apiUpdateToolClassify <T> (data: any): Promise<T> {
  return http({
    method: 'put',
    url: '/api/v1/tool/classify',
    data
  })
}

export function apiChangeSelfPassword <T> (data: any): Promise<T> {
  return http({
    method: 'post',
    url: '/api/v1/staff/change-password-self',
    data
  })
}

export function apiChangePassword <T> (data: any): Promise<T> {
  return http({
    method: 'post',
    url: '/api/v1/staff/change-password',
    data
  })
}

export function apiGetCountall <T> (): Promise<T> {
  return http({
    method: 'get',
    url: '/api/v1/statistic/count-all'
  })
}

export function apiGetPublicTrend <T> (): Promise<T> {
  return http({
    method: 'get',
    url: '/api/v1/statistic/public-trend'
  })
}

export function apiGetVisitCounts <T> (): Promise<T> {
  return http({
    method: 'get',
    url: '/api/v1/statistic/visit-counts'
  })
}

export function apiGetHotTags <T> (): Promise<T> {
  return http({
    method: 'get',
    url: '/api/v1/statistic/hot-tags'
  })
}

export function apiGetHotArticles <T> (): Promise<T> {
  return http({
    method: 'get',
    url: '/api/v1/statistic/hot-articles'
  })
}

export function apiGeCityVisitCount <T> (): Promise<T> {
  return http({
    method: 'get',
    url: '/api/v1/statistic/city-visit-count'
  })
}

export function apiGetVisitFromC <T> (params: any): Promise<T> {
  return http({
    method: 'get',
    url: '/api/v1/visit',
    params
  })
}

export function apiGetFriendLinkList <T> (): Promise<T> {
  return http({
    method: 'get',
    url: '/api/v1/friend-link'
  })
}

export function apiCreateFriendLink <T> (data: any): Promise<T> {
  return http({
    method: 'post',
    url: '/api/v1/friend-link',
    data
  })
}

export function apiUpdateFriendLink <T> (data: any): Promise<T> {
  return http({
    method: 'put',
    url: '/api/v1/friend-link',
    data
  })
}

export function apiDeleteFriendLinks <T> (data: any): Promise<T> {
  return http({
    method: 'delete',
    url: '/api/v1/friend-link',
    data
  })
}

export function apiGetXmindList <T> (params: any): Promise<T> {
  return http({
    method: 'get',
    url: '/api/v1/xmind',
    params
  })
}

export function apiUpdateXmindRecommend <T> (data: any): Promise<T> {
  return http({
    method: 'post',
    url: '/api/v1/xmind/update-recommend',
    data
  })
}
